package com.sample.xcrash.slice;

import com.sample.xcrash.ResourceTable;
import com.sample.xcrash_lib.XCrash;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class SecondAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_second);

        final HiLogLabel lable = new HiLogLabel(HiLog.LOG_APP, 0x00201, "getStringParam() => type ");

        String type = intent.getStringParam("type");
        HiLog.error(lable, type, "SecondAbility type");

        if (type != null) {
            if (type.equals("native")) {
                XCrash.testNativeCrash(false);
            } else if (type.equals("java")) {
                XCrash.testJavaCrash(false);
            }
        }
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
